import React, { Component } from 'react';
import {
  BrowserRouter as Router,
  Route,
  HashRouter,
  Switch,
} from 'react-router-dom';
import routers from './routers/routers.js';
import 'antd/dist/antd.css';
import '../../componentCss/component.css';
//import './index.css';

//字典
class Index extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }
  componentWillMount() {}
  componentDidMount() {}
  //组件销毁时取消setState
  componentWillUnmount() {
    this.setState = (state, callback) => {
      return;
    };
  }
  render() {
    return (
      <div>
        <Switch>
          {routers.map((route, i) => (
            <Route
              key={i}
              path={route.path}
              render={(props) => (
                <route.component {...props} routes={route.routes} />
              )}
            />
          ))}
        </Switch>
      </div>
    );
  }
}

export default Index;
